package com.xt.purchasingsystem.controller;


import com.xt.purchasingsystem.dto.QualityDto;
import com.xt.purchasingsystem.service.QualityService;
import com.xt.purchasingsystem.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author yhp
 * @since 2020-05-31
 */
@RestController
@RequestMapping("/quality")
public class QualityController {

    @Autowired
    private QualityService qualityService;

    /**
     * 添加质检及其质检详细数据
     * 修改放货登记质检状态的接口
     */
    @PostMapping
    public Result saveQualityAndDetail(@RequestBody QualityDto qualityDto) {
        return qualityService.saveQualityAndDetail(qualityDto);
    }

    /**
     * 分页查询所有未审核的质检单及其明细的接口
     */
    @GetMapping("getAllNoCheckQualityAndDetails/{currNo}/{pageSize}")
    public Result registrationQualitytion(@PathVariable Integer currNo, @PathVariable Integer pageSize) {
        return qualityService.getAllNoCheckQualityAndDetails(currNo, pageSize);
    }

    @PutMapping
    public Result checkQuality(@RequestBody QualityDto qualityDto) {
        return qualityService.checkQuality(qualityDto);
    }
}

